<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/js/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css" />

		<script src="/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/jquery.form.js"></script>
        <script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
        <script src="/dialog/js/dialog.js"></script>
        <script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/flatpickr.js"></script>
	</head>

	<body>
		<!--顶部导航 -->
		<nav class="topNavItemBox">
			<div id="ItemBox">
				<div class="title">肉品溯源管理系统</div>
			</div>
		</nav>
		<!-- 左侧导航 -->
		<#include "left.ftl"/>

        <!--生猪入库查询-->
		<div class="page_main">
			<h3>生猪入场管理</h3><span class="add_link"><a href="/admin/PigIn/toAddPigInPage">新增生猪入场信息></a></span>
			<div class="page_content">
				<h4>生猪入场查询</h4>
				<br /><br />
				<form id="pigIn_query" method="post" action="/admin/PigIn/findByCondition">
					<!-- <label>生猪名称</label><input type="text" name="" id="vaccine_name" class="commonInputtext" /> -->
					<label style="width:100px">生猪编号</label><input type="text" name="purGid"  value="${purGid}" class="commonInputtext" /><span></span>
					<label style="width:100px">开始日期</label><input type="text" name="beginTime"   id="pigIn_starttime" class="commonInputtext" /><span></span>
					<label style="width:100px">结束日期</label><input type="text" name="endTime"    id="pigIn_endtime" class="commonInputtext" />
					<input type="submit" value="查询" style="display: inline-block; margin-left: 30px;" />
					<br />
				</form>
				<div>
					<table id="pigIn_table" class="table" width="100%">
						<thead>
							<tr>
								<th width="30"><input type="checkbox" onclick="selectAll()" id="allSelect" class="allSelect" ></th>
								<th width="150">生猪编号</th>
								<th width="150">场区</th>
								<th width="150">生猪重量</th>
								<th width="150">生猪等级</th>
								<th width="150">采购时间</th>
								<th width="150">采购人</th>
								<th width="150">供货人</th>
								<th width="150">供货人电话</th>
								<th width="150">采购地点</th>
								<th width="80"></th>
							</tr>
						</thead>
						<tbody>

						<#list pageInfo.list as pigIn >
							<tr>
										<td><input name="isCheck"  type="checkbox" value="${pigIn.gid}"/></td>
										<td>${pigIn.purGid}</td>
										<td>${pigIn.areAreaid}</td>
										<td>${pigIn.inweight}</td>
										<td>${pigIn.grade}</td>
										<td>${(pigIn.intime?string('yyyy-MM-dd'))}</td>
										<td>${pigIn.receivername}</td>
										<td>${pigIn.supplyname}</td>
										<td>${pigIn.supplytel}</td>
										<td>${pigIn.buyplace}</td>
										<td><input type="button" onclick="edit1(${pigIn.gid})"  value="编辑"/></td>
							</tr>
							</#list>
						</tbody>
					</table>
				</div>
                <input type="button" id="delete" onclick="deleteByids()" value="删除所选">>
			</div>
			<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
		</div>


		<script type="text/javascript" charset="UTF-8">
			$(function() {
				//侧边栏初始化
				$(".vertical-nav").verticalnav({
					speed: 400,
					align: "left"
				});

				//时间控制初始化
				$("#pigIn_starttime").flatpickr();
				$("#pigIn_endtime").flatpickr();

			});

            //全选、全不选
            function selectAll() {
                if ($("#allSelect").is(":checked")) {
                    $("input[name='isCheck']").prop("checked",true);
                } else {
                    $("input[name='isCheck']").prop("checked",false);
                }
            }

            //批量删除
            function deleteByids() {
                var option = $("input[name='isCheck']:checked");
                var selectRows = "";
                for (var i = 0; i < option.length; i++) {
                    if (i == 0) {
                        selectRows += option[i].value;
                    } else {
                        selectRows += "," + option[i].value;
                    }
                }
                $.dialog({
                    type: 'confirm',
                    contentHtml: '<p style:"magrin:0 auto">确认删除？</p>',
                    onClickOk: function () {
                        $.ajax({
                            url: "/admin/PigIn/delete",
                            data: {
                                'selectRows': selectRows
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                //弹失败框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/fail.png" alt="删除失败" /><p class="info-text">删除失败</p>',
                                    autoClose: 2000
                                });
                            },
                            success: function () {
                                //弹成功框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/success.png" alt="删除成功" /><p class="info-text">删除成功</p>',
                                    autoClose: 2000
                                });
                                setTimeout("window.location.reload();", 2000);

                            }
                        });
                    }
                });
            }



		</script>

	</body>

</html>